package com.briup.service;

import com.briup.bean.Teacher;
import com.briup.dao.ITeacherDAO;
import com.briup.exception.TeacherException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// <bean></bean>
// @Controller
@Service //扫描该注解 创建service实现类对象 IOC容器中
public class TeacherServiceImpl implements ITeacherService{
    @Autowired
    private ITeacherDAO dao;//= new TeacherDAOImpl();
    @Override
    public Teacher findTeacherById(Integer id) throws Exception{
        if(id == 0){
            //用户自定义的异常情况
           throw new TeacherException("工号不存在为0的情况");
        }
        if(id > 100){
            System.out.println(1/0);
        }
        return dao.findTeacherById(id);
    }
}
